package com.leetcode.algorithm.y22.m08.w4;

/**
 * 1460. 通过翻转子数组使两个数组相等
 * 
 * https://leetcode.cn/problems/make-two-arrays-equal-by-reversing-sub-arrays/
 * 
 * @author jie.deng
 *
 */
class Question1460Solution01 {

	public boolean canBeEqual(int[] target, int[] arr) {
		int[] cntArr = new int[1001];
		for (int num : target) {
			cntArr[num]++;
		}
		for (int num : arr) {
			if (cntArr[num] <= 0) {
				return false;
			}
			cntArr[num]--;
		}
		return true;
	}

}